<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>tinydtls: dtls_handler_t Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">tinydtls
   &#160;<span id="projectnumber">0.8.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-attribs">Data Fields</a>  </div>
  <div class="headertitle">
<div class="title">dtls_handler_t Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="dtls_8h_source.html">dtls.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a161ad99d77bd3b963bcd473eb3cbefe2"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structdtls__handler__t.html#a161ad99d77bd3b963bcd473eb3cbefe2">write</a> )(struct <a class="el" href="structdtls__context__t.html">dtls_context_t</a> *ctx, <a class="el" href="structsession__t.html">session_t</a> *session, <a class="el" href="global_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *buf, size_t len)</td></tr>
<tr class="separator:a161ad99d77bd3b963bcd473eb3cbefe2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a48f28d381286b493fe6dd8eab5cbaa88"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structdtls__handler__t.html#a48f28d381286b493fe6dd8eab5cbaa88">read</a> )(struct <a class="el" href="structdtls__context__t.html">dtls_context_t</a> *ctx, <a class="el" href="structsession__t.html">session_t</a> *session, <a class="el" href="global_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *buf, size_t len)</td></tr>
<tr class="separator:a48f28d381286b493fe6dd8eab5cbaa88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae2db3733c5f0a0eea9a635490bdfe59"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structdtls__handler__t.html#aae2db3733c5f0a0eea9a635490bdfe59">event</a> )(struct <a class="el" href="structdtls__context__t.html">dtls_context_t</a> *ctx, <a class="el" href="structsession__t.html">session_t</a> *session, <a class="el" href="alert_8h.html#ab6264d1b950719f1c2e00b122cad871f">dtls_alert_level_t</a> level, unsigned short code)</td></tr>
<tr class="separator:aae2db3733c5f0a0eea9a635490bdfe59"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This structure contains callback functions used by tinydtls to communicate with the application. At least the write function must be provided. It is called by the DTLS state machine to send packets over the network. The read function is invoked to deliver decrypted and verfified application data. The third callback is an event handler function that is called when alert messages are encountered or events generated by the library have occured. </p>

<p>Definition at line <a class="el" href="dtls_8h_source.html#l00084">84</a> of file <a class="el" href="dtls_8h_source.html">dtls.h</a>.</p>
</div><h2 class="groupheader">Field Documentation</h2>
<a class="anchor" id="aae2db3733c5f0a0eea9a635490bdfe59"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* dtls_handler_t::event)(struct <a class="el" href="structdtls__context__t.html">dtls_context_t</a> *ctx, <a class="el" href="structsession__t.html">session_t</a> *session, <a class="el" href="alert_8h.html#ab6264d1b950719f1c2e00b122cad871f">dtls_alert_level_t</a> level, unsigned short code)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The event handler is called when a message from the alert protocol is received or the state of the DTLS session changes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The current dtls context. </td></tr>
    <tr><td class="paramname">session</td><td>The session object that was affected. </td></tr>
    <tr><td class="paramname">level</td><td>The alert level or <code>0</code> when an event ocurred that is not an alert. </td></tr>
    <tr><td class="paramname">code</td><td>Values less than <code>256</code> indicate alerts, while <code>256</code> or greater indicate internal DTLS session changes. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ignored </dd></dl>

<p>Definition at line <a class="el" href="dtls_8h_source.html#l00129">129</a> of file <a class="el" href="dtls_8h_source.html">dtls.h</a>.</p>

</div>
</div>
<a class="anchor" id="a48f28d381286b493fe6dd8eab5cbaa88"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* dtls_handler_t::read)(struct <a class="el" href="structdtls__context__t.html">dtls_context_t</a> *ctx, <a class="el" href="structsession__t.html">session_t</a> *session, <a class="el" href="global_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *buf, size_t len)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Called from <a class="el" href="dtls_8c.html#ae272fea7269714fe7a67d6da64961731">dtls_handle_message()</a> deliver application data that was received on the given session. The data is delivered only after decryption and verification have succeeded.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The current DTLS context. </td></tr>
    <tr><td class="paramname">session</td><td>The session object, including the address of the data's origin. </td></tr>
    <tr><td class="paramname">buf</td><td>The received data packet. </td></tr>
    <tr><td class="paramname">len</td><td>The actual length of <code>buf</code>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ignored </dd></dl>

<p>Definition at line <a class="el" href="dtls_8h_source.html#l00114">114</a> of file <a class="el" href="dtls_8h_source.html">dtls.h</a>.</p>

</div>
</div>
<a class="anchor" id="a161ad99d77bd3b963bcd473eb3cbefe2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* dtls_handler_t::write)(struct <a class="el" href="structdtls__context__t.html">dtls_context_t</a> *ctx, <a class="el" href="structsession__t.html">session_t</a> *session, <a class="el" href="global_8h.html#adde6aaee8457bee49c2a92621fe22b79">uint8</a> *buf, size_t len)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Called from <a class="el" href="dtls_8c.html#ae272fea7269714fe7a67d6da64961731">dtls_handle_message()</a> to send DTLS packets over the network. The callback function must use the network interface denoted by session-&gt;ifindex to send the data.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The current DTLS context. </td></tr>
    <tr><td class="paramname">session</td><td>The session object, including the address of the remote peer where the data shall be sent. </td></tr>
    <tr><td class="paramname">buf</td><td>The data to send. </td></tr>
    <tr><td class="paramname">len</td><td>The actual length of <code>buf</code>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The callback function must return the number of bytes that were sent, or a value less than zero to indicate an error. </dd></dl>

<p>Definition at line <a class="el" href="dtls_8h_source.html#l00099">99</a> of file <a class="el" href="dtls_8h_source.html">dtls.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="dtls_8h_source.html">dtls.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Feb 27 2015 15:15:33 for tinydtls by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
